﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace tiDE.SourceInsight
{
    public class AxeSourceInsight : ISourceInsightProvider
    {
        public string[] SupportedFileTypes
        {
            get { return new string[] { ".axe" }; }
        }

        public List<SourceLocation> GetSourceLocations(string Source, string SourceFile)
        {
            List<SourceLocation> sourceLocations = new List<SourceLocation>();
            int lineNumber = 0;
            string[] lines = Source.Replace("\r", "").Split('\n');
            foreach (string line in lines)
            {
                string thisLine = line.Clone() as string;
                int oldLength = thisLine.Length;
                thisLine = thisLine.TrimStart();
                int startIndex = oldLength - thisLine.Length;
                thisLine = thisLine.Trim();
                if (thisLine.StartsWith("Lbl "))
                {
                    sourceLocations.Add(new SourceLocation(lineNumber, startIndex, thisLine.Substring(4).Length, thisLine.Substring(4)));
                }
                lineNumber++;
            }
            return sourceLocations;
        }

        public string BitmapToSource(Bitmap Bitmap, int numLevels)
        {
            return "";
        }

        public Bitmap SourceToBitmap(string source, int numLevels, int Width, int Height)
        {
            return null;
        }
    }
}
